home *** CD-ROM | disk | FTP | other *** search
- Path: newsbf02.news.aol.com!not-for-mail
- From: razine@aol.com (Razine)
- Newsgroups: comp.lang.c++
- Subject: Question:Structures / Binary Files / Searching
- Date: 19 Feb 1996 00:31:35 -0500
- Organization: America Online, Inc. (1-800-827-6364)
- Sender: root@newsbf02.news.aol.com
- Message-ID: <4g91vn$f3k@newsbf02.news.aol.com>
- Reply-To: razine@aol.com (Razine)
- NNTP-Posting-Host: newsbf02.mail.aol.com
-
- I currently have a Structure of 512 bytes. I would like to search this
- file to match names. I am seeing if there is a better way to do it then
- how I am doing it. This is how I am doing it right now.
-
- open the file
- get the filelength
- divide the filelenght by the sizeof(userrec) to get number of records.
- then I lseek in 512 byte increments
- read in the first 30 bytes which contains the name
- then I strcmp them
- if they match I exit
- if it doesnt match I lseek to the next record and check
-
- Is there a faster way? Easier way? let me know please what you think...
-
- Darrell
-